package me.report.api.web.controller.admin;

import me.report.api.mongodb.service.MongoService;
import me.report.mongodb.model.Report;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
import org.apache.log4j.Logger;

@Controller
@RequestMapping("/report")
public class ReportController {

    Logger logger = Logger.getLogger(getClass());
    @Autowired
    private MongoService mongoService;

    @RequestMapping(value = "")
    public String report(ModelMap model) {
        List<Report> listReport = mongoService.getAll();
        model.addAttribute("reports", listReport);
        return "report";
    }
}
